﻿using HomagChina.CCT.ViewModels;
using HomagChina.CCT.DataTypeModel;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using static HomagChina.CCT.ProcessResourceInternal;
using static HomagChina.CCT.Utility;
using Application = System.Windows.Application;
using MenuItem = HomagGroup.Base.UI.Controls.MenuItem;

using HomagGroup.BaseUI;

namespace HomagChina.CCT.Router
{
    public class ErrorMessageRoute
    {
        public RouterItemDataModel ErrorMessageRouteModel { get; set; }

        public ErrorMessageRoute()
        {
            var model = new ErrorMessageViewModel();
            ErrorMessageRouteModel = new RouterItemDataModel()
            {
                ID = "ErrorMessage",
                viewLabel = GetLocalText("Error message"),
                viewName = "ErrorMessage",
                viewModelName = "ErrorMessageViewModel",
                ViewModel = model,
                keepalive = false,
                userControl = GetUserControlInstance("ErrorMessage"),
                Image = null,
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>{
                    new FunctionKeyBarItemDataModel() {
                        Header =GetLocalText("Filter_on") ,
                        Position = 9,
                        Icon = GetIconBrush(Icon.ViewGrid,overlayIcon:OverlayIcon.Check),
                        Command=new RelayCommand(model.HandleIsShowFilter)
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =GetLocaText("Extras"),
                    //    Position = 10,
                    //    Icon = GetIconBrush(Icon.More, overlayIcon: OverlayIcon.None),
                    //    MenuItems = new List<MenuItem>
                    //    {
                    //        new MenuItem {
                    //            Header =GetLocaText("Settings"),
                    //            Icon = GetResourceBrush("items")
                    //        },
                    //        new MenuItem {
                    //            Header = GetLocaText("Create service file"),
                    //            Icon = GetResourceBrush("TableSettingsImage")
                    //        }
                    //    }
                    //},
                    new FunctionKeyBarItemDataModel(){
                        Header = GetLocalText("Advanced"),
                        Position = 10,
                        Icon = GetResourceBrush("Advanced"),
                        MenuItems = new List<MenuItem>
                        {
                            new MenuItem {
                                Header =  GetLocalText("Freeze"),
                                IsCheckable = true,
                                Command = new RelayCommand(model.HandleIsFreeze)
                            },
                            new MenuItem {
                                Header =  GetLocalText("History"),
                                IsCheckable = true,
                                Command = new RelayCommand(model.HandleIsHistory)
                            }
                        }
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Exit"),
                    //    Position = 12,
                    //    Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                    //    Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                    //},
                }
            };
            ErrorMessageRouteModel.userControl.DataContext = model;
        }
    }
}